﻿using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Instances;

namespace Magalie.Data.NHibernateMaps.Conventions
{
    /// <summary>
    /// Convention de mapping des relations one to many
    /// </summary>
    public class HasManyConvention : IHasManyConvention
    {
        /// <summary>
        /// Apply changes to the target
        /// </summary>
        /// <param name="instance">
        /// The instance.
        /// </param>
        public void Apply(IOneToManyCollectionInstance instance)
        {
            // instance.Key.Columns.Clear();
            
            instance.Key.Column(instance.EntityType.Name + "ID");
        }
    }
}